package com.afd.ozblip.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

public class SettingActivity extends BaseActivity {

	/****************** 视图变量 **************************/
	private LinearLayout bindAccountLayout;
	private LinearLayout userDetailLayout;
	private LinearLayout messageNoticeLayout;
	private LinearLayout languageLayout;
	private LinearLayout privacyLayout;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.setting);
		// 启动返回功能
		toBack();
		// 寻找视图
		findViews();
		// 设置监听
		setListeners();
		// 获取参数
		getBundle();
	}

	/**
	 * 寻找视图
	 */
	public void findViews() {
		this.bindAccountLayout = (LinearLayout) findViewById(R.id.ll_setting_bindAccount);
		this.userDetailLayout = (LinearLayout) findViewById(R.id.ll_setting_userInfo);
		this.messageNoticeLayout = (LinearLayout) findViewById(R.id.ll_setting_messageNotice);
		this.languageLayout = (LinearLayout) findViewById(R.id.ll_setting_language);
		this.privacyLayout = (LinearLayout) findViewById(R.id.ll_setting_privacy);
	}

	/**
	 * 设置监听
	 */
	public void setListeners() {
		View.OnClickListener moreClick = new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				switch (v.getId()) {
				case R.id.ll_setting_bindAccount:
					Intent bindIntent = new Intent(SettingActivity.this,
							GamAccountActivity.class);
					startActivity(bindIntent);
					break;
				case R.id.ll_setting_userInfo:
					if (commonUserInfo == null) {
						showLoginDialog();
					} else {
						Intent userInfoIntent = new Intent(
								SettingActivity.this, UserDetailActivity.class);
						startActivity(userInfoIntent);
					}
					break;
				case R.id.ll_setting_messageNotice:
					Intent msgNoticeIntent = new Intent(SettingActivity.this,
							MessageNoticeActivity.class);
					startActivity(msgNoticeIntent);
					break;
				case R.id.ll_setting_language:
					Intent languageIntent = new Intent(SettingActivity.this,
							LanguageActivity.class);
					startActivity(languageIntent);
					break;
				case R.id.ll_setting_privacy:
					Intent privacyIntent = new Intent(SettingActivity.this,
							PrivacyActivity.class);
					startActivity(privacyIntent);
					break;

				default:
					break;
				}
			}
		};
		this.bindAccountLayout.setOnClickListener(moreClick);
		this.userDetailLayout.setOnClickListener(moreClick);
		this.messageNoticeLayout.setOnClickListener(moreClick);
		this.languageLayout.setOnClickListener(moreClick);
		this.privacyLayout.setOnClickListener(moreClick);
	}

	/**
	 * 获取传递的参数
	 */
	private void getBundle() {
		Intent intent = getIntent();
	}
}